package com.casstime.ec.cloud.meeting.model;

import com.casstime.ec.cloud.meeting.dao.entity.EntityBookDetail;
import com.casstime.ec.cloud.meeting.values.BookDetailDTO;
import com.casstime.ec.cloud.stastic.transform.CommonTransform;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Data;

@Data
public class BookDetail {

  @ApiModelProperty(value="预约id")
  private Integer id;

  @ApiModelProperty(value="预约会议室名称")
  private String roomName;

  @ApiModelProperty(value="预约会议主题")
  private String theme;

  @ApiModelProperty(value="预约申请人姓名")
  private String applyUserName;

  @ApiModelProperty(value="预约会议开始时间")
  private Date startAt;

  @ApiModelProperty(value="预约会议结束时间")
  private Date endAt;

  @ApiModelProperty(value="预约会议状态： 0:未开始 1:进行中 2:已完成")
  private Integer status;

  public static BookDetail get(EntityBookDetail entityBookDetail) {
      BookDetail bookDetail = new BookDetail();
      bookDetail.setId(entityBookDetail.getId());
      bookDetail.setRoomName(entityBookDetail.getRoomName());
      bookDetail.setTheme(entityBookDetail.getTheme());
      bookDetail.setApplyUserName(entityBookDetail.getUsername());
      bookDetail.setStartAt(entityBookDetail.getBeginAt());
      bookDetail.setEndAt(entityBookDetail.getEndAt());
      bookDetail.setStatus(Integer.parseInt(entityBookDetail.getState()));
      return bookDetail;
  }


  public BookDetailDTO toDTO() {
    return CommonTransform.transform(this,BookDetailDTO.class);
  }





}
